#=!/usr/bin/env python
#-*- coding:utf-8 -*-

from django.conf.urls.defaults import *
from weblog import feeds
from django.conf import settings

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

feed_dict = {
    'rss': feeds.RssLatestPosts,
    'atom': feeds.AtomLatestPosts,
    }

#urls for admin
urlpatterns = patterns('',
    (r'^' + settings.STATIC_URL + '/(?P<path>.*)$', 'django.views.static.serve',
        {'document_root': settings.STATIC_PATH}),
    (r'^admin/', include(admin.site.urls)),
)

#urls for feed 
urlpatterns += patterns('',
    (r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed',
    {'feed_dict': feed_dict}),
)

#urls for weblog
urlpatterns += patterns('weblog.views',
    (r'^$', 'index'),
    (r'^(\d+)/$', 'year'),
    (r'^(\d+)/(\d+)/$', 'month'),
    (r'^(\d+)/(\d+)/(\w+)/$', 'post'),
    (r'^tag/(\d+)/$', 'tag'),
    (r'^search/$', 'search'),
    (r'^search/(\.*)/$', 'search'),
    (r'^logout/$', 'logout_view'),
    (r'^import/$', 'import_view'),
)
